class Admin::UsersController < Admin::BaseController

	def new
    @admin_user = AdminUser.new
  end
  
  def create
    @admin_user = AdminUser.new(params[:admin_user])
    if AdminUser.find_by_admin_name(params[:admin_user][:admin_name])
      flash[:error] = "用户名称#{params[:admin_user][:admin_name]}已经存在"
      render 'new'
    else
      success = @admin_user && @admin_user.save
      flash[:notice] = "添加用户成功"
      redirect_to :action => "new" if success
    end
  end
  
  def update
  end
  
  def destroy
  end
end
